# 点赞视频
import time
from selenium.webdriver import ActionChains


def dianZan(BV, wd):
    url = 'https://www.bilibili.com/video/{}'.format(BV)
    wd.get(url)
    time.sleep(10)

    # 播放
    x = 186 + 100
    y = 152 + 100
    ActionChains(wd).move_by_offset(x, y).click().perform()  # 点击播放
    ActionChains(wd).move_by_offset(-x, -y).perform()  # 将鼠标位置恢复到移动前
    time.sleep(10)

    # 点赞
    dianzan = wd.find_element_by_class_name('van-icon-videodetails_like')
    dianzan.click()
    time.sleep(5)

    wd.close()
